package com.itheima.day07;

public class homeWork6 {
    /*
    已知一个数组 arr = {19, 28, 37, 46, 50};
    用程序实现把数组中的元素值反转(在原数组中操作，
    不能定义第二个数组)，反转后的数组 arr = {50, 46, 37, 28, 19};
    并在控制台输出反转后的数组元素。反馈该题
     */
    public static void main(String[] args) {
        int[] arr = {19, 28, 37, 46, 50};
        for(int start = 0,end = arr.length - 1; start < end;start++,end--){
            int temp = arr[start];
            arr[start] = arr[end];
            arr[end] = temp;
        }
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ,");
            if(i == arr.length - 1){
                System.out.println(arr[i] + "]");
            }
        }
    }
}
